﻿@using EasyCourse.Model;
@using EasyCourse.DB;
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>我的发帖</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
</head>
<body>
    @Html.Partial("~/Views/Share/PublicTopNav2.cshtml")
    <div class="container">
        <div class="row">
            <h1 class="topTitle-h1">康复治疗微课程网络学习平台<br><small>广州中医药大学康复治疗微课程网络学习平台</small></h1>
        </div>
    </div>
    <div class="container-fluid yue-nav mb15">
        <div class="container">
            <div class="row">
                <ul>
                    <li><a target="_blank" href='@Url.Action("Index","Home")'>课程群首页</a></li>
                    <li><a href="javascript:void(0);" class="current">论坛讨论</a></li>
                    <li><a href="@Url.Action("List", "StudentResManage")">资源管理</a></li>
                    <li><a  href="@Url.Action("StudentPersonalInfo", "UserInfo")">个人信息</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container mainwrap">
        <div class="row">
            <div class="col-xs-2">
                <div class="dropdown theme-dropdown clearfix">
                    <a id="dropdownMenu1" href="#" role="button" class="sr-only dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                        <li class="active" role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)"><span class="glyphicon glyphicon-edit"></span> 我的发帖</a></li>
                    </ul>
                </div>
            </div>
            <div class="col-xs-10">
                <div class="panel panel-default mainwrap-part">
                    <div class="panel-heading">
                        <ol class="breadcrumb">
                            <li>讨论区</li>
                            <li class="active">我的发帖</li>
                        </ol>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-hover ">
                            <thead>
                                <tr>
                                    <th width="20%">所属课程</th>
                                    <th width="30%">标题</th>
                                    <th width="10%">作者</th>
                                    <th width="10%">发表日期</th>
                                    <th width="10%">点击量</th>
                                    <th width="10%">回复量</th>
                                    <th width="10%">最后回复</th>
                                </tr>
                            </thead>
                            <tbody id="JzyList">
                             
                            </tbody>
                        </table>
                        <div class="row clearfix well d-page">
                            <div id="PagInfo" class="pull-left sum"></div>
                            <div class="clearfix pull-right">
                                <ul id="PageTool" class="pagination"></ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @Html.Partial("~/Views/Share/PublicFooter.cshtml")
    @Html.Partial("~/Views/Share/PublicCommonJs.cshtml")
    <script type="text/javascript">
        var JzyList = $("#JzyList");
        var PageNO = 1;

        function getList(pageNo) {
            PageNO = pageNo;
            $.easyPost("/Discussion/SearchMyDiscussion", {
                "PageNO": PageNO,
                "PageSize": 20,
                "CourseId": "",
                "Title": ""
            }, function (data) {
                if (!data.result) {
                    showTips.open(data.message);
                    return;
                }
                if (data.rows.length > 0) {
                    var _row = data.rows,
                        _rowL = _row.length,
                        _html = '',
                    options = {
                        totalPages: data.totalPage,
                        total: data.total,
                        currentPage: PageNO,
                        numberOfPages: 20,
                        onPageClicked: function (event, originalEvent, type, page) {
                            getList(page)
                        }
                    };
                    initialPaginator(options, "PageTool", "PagInfo");
                    for (var i = 0; i < _rowL; i++) {
                        var item = _row[i];
                        var _date = item.Entity.CreateTime.toString().replace(/\//g, "");
                        var time = eval('new ' + _date);
                        _html += '<tr>' +
                                    '<td>' + item.CourseName + '</td>'+
                                    '<td>' +
                                        '<a href="@Url.Action("Detail", "Discussion")?CourseId=' + item.Entity.CourseId + '&DiscussId=' + item.Entity.Id + '" target="_blank">' + item.Entity.Title + '</a>' +
                                        '</td>' +
                                        '<td>' + item.Entity.Creator + '</td>' +
                                        '<td>' + time.format('yyyy-MM-dd') + '</td>' +
                                        '<td>' + item.Entity.VisitTimes + '</td>' +
                                        '<td>' + item.Entity.ReplyTimes + '</td>' +
                                        '<td>' + item.Entity.Replyer + '</td>' +
                                    '</tr>';
                       }
                       JzyList.html(_html);
                   } else {
                       var _html = '<tr><td colspan="7" align="center">暂无内容</td></tr>'
                       JzyList.html(_html)
                   }
            }, "json");
           }
        getList(PageNO);
    </script>
</body>
</html>